﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Styx;
using Styx.Common;
using Styx.CommonBot;
using Styx.CommonBot.Profiles;
using Styx.Pathing;						
using Styx.WoWInternals;				
using Styx.WoWInternals.WoWObjects;		
using Styx.Plugins;

namespace rndbuddy
{
    static class CMDPipe
    {
        public static void issue_command(string command)
        {
            switch (command)
            {
                case "null":
                    break;
                case "refresh":
                    rndbuddy.log("command: refresh");
                    ProfileHandler.get_profile();
                    break;
                case "start":
                    startBot();
                    break;
                case "stop":
                    stopBot();
                    break;
                case "kill":
                    kill();
                    break;
                case "debug":
                    Toon t = new Toon();
                    t.poll();
                    rndbuddy.log(t.Name);
                    rndbuddy.log(t.Class);
                    break;
                case "refresh_settings":
                    settings.parse_remote_settings();
                    break;
                case "screenshot":
                    rndbuddy.take_screenshot();
                    break;
                case "kill_in_10":
                    settings.timed_kill = DateTime.Now.AddMinutes(10);
                    break;
                case "kill_in_30":
                    settings.timed_kill = DateTime.Now.AddMinutes(30);
                    break;
                case "kill_in_60":
                    settings.timed_kill = DateTime.Now.AddMinutes(60);
                    break;
                case "kill_in_120":
                    settings.timed_kill = DateTime.Now.AddMinutes(120);
                    break;
                case "kill_in_240":
                    settings.timed_kill = DateTime.Now.AddMinutes(240);
                    break;
                case "load_ahbot":
                    ProfileHandler.load_professionbuddy_ahbot();
                    break;
                case "use_gb2":
                    BotController.use_gb2();
                    break;
                case "use_pb":
                    BotController.use_pb();
                    break;
                case "pb_zone_pandaria":
                    ProfileHandler.pb_desired_zone = "870";
                    ProfileHandler.get_profile();
                    break;
                case "pb_zone_kalimdor":
                    ProfileHandler.pb_desired_zone = "1";
                    ProfileHandler.get_profile();
                    break;
                case "pb_zone_easternkingdoms":
                    ProfileHandler.pb_desired_zone = "0";
                    ProfileHandler.get_profile();
                    break;
                case "pb_zone_outlands":
                    ProfileHandler.pb_desired_zone = "530";
                    ProfileHandler.get_profile();
                    break;
                case "pb_zone_northrend":
                    ProfileHandler.pb_desired_zone = "571";
                    ProfileHandler.get_profile();
                    break;
                case "pb_zone_draenor":
                    ProfileHandler.pb_desired_zone = "9999";
                    ProfileHandler.get_profile();
                    break;
                case "no tasks":
                    break;
                default:
                    rndbuddy.log("Unsupported Command "+command);
                    break;
            }
        }

        public static void startBot()
        {
            Styx.CommonBot.TreeRoot.Start();
        }

        public static void stopBot()
        {
            Styx.CommonBot.TreeRoot.Stop();
        }

        public static void kill()
        {
            Styx.StyxWoW.Memory.Process.Kill();
        }
    }
}
